package org.xtext.ic.dsl.generator;

import org.eclipse.xtend2.lib.StringConcatenation;
import org.xtext.ic.dsl.icDsl.Attribute;
import org.xtext.ic.dsl.icDsl.Entity;
import org.xtext.ic.dsl.icDsl.Type;

@SuppressWarnings("all")
public class HibernateAnnotationsExtensions {
  public CharSequence oneToOne() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@OneToOne");
    return _builder;
  }
  
  public CharSequence oneToOne(final Attribute a) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@OneToOne(mappedBy=\"");
    String _name = a.getName();
    _builder.append(_name, "");
    _builder.append("\",cascade=CascadeType.ALL)");
    return _builder;
  }
  
  public CharSequence oneToMany(final Attribute a) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@OneToMany(mappedBy=\"");
    String _name = a.getName();
    _builder.append(_name, "");
    _builder.append("\")");
    return _builder;
  }
  
  public CharSequence manyToOne() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@ManyToOne");
    return _builder;
  }
  
  public CharSequence manyToMany() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@ManyToMany(cascade=CascadeType.ALL)");
    return _builder;
  }
  
  public CharSequence manyToMany(final Attribute a) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@ManyToMany(mappedBy=\"");
    String _name = a.getName();
    _builder.append(_name, "");
    _builder.append("\")");
    return _builder;
  }
  
  public CharSequence entity() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@Entity");
    return _builder;
  }
  
  public CharSequence id() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@Id");
    return _builder;
  }
  
  public CharSequence generatedValue() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@GeneratedValue");
    return _builder;
  }
  
  public CharSequence temporal() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@Temporal(javax.persistence.TemporalType.DATE)");
    return _builder;
  }
  
  public CharSequence inheritance() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@Inheritance(strategy=InheritanceType.JOINED)");
    return _builder;
  }
  
  public CharSequence table(final Entity e) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@Table(name=\"");
    String _name = e.getName();
    _builder.append(_name, "");
    _builder.append("\")");
    return _builder;
  }
  
  public CharSequence column(final Attribute a) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@Column(name=\"");
    String _name = a.getName();
    _builder.append(_name, "");
    _builder.append("\")");
    return _builder;
  }
  
  public CharSequence joinColumn(final Attribute a) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@JoinColumn(name=\"");
    String _name = a.getName();
    _builder.append(_name, "");
    _builder.append("\")");
    return _builder;
  }
  
  public CharSequence primaryKeyJoinColumn() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@PrimaryKeyJoinColumn");
    return _builder;
  }
  
  public CharSequence primaryKeyJoinColumn(final Attribute a) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@PrimaryKeyJoinColumn(name=\"");
    String _name = a.getName();
    _builder.append(_name, "");
    _builder.append("\")");
    return _builder;
  }
  
  public CharSequence joinTable(final Attribute a, final Attribute ar) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("@JoinTable(name=\"");
    Type _type = a.getType();
    String _name = _type.getName();
    _builder.append(_name, "");
    Type _type_1 = ar.getType();
    String _name_1 = _type_1.getName();
    _builder.append(_name_1, "");
    _builder.append("\",joinColumns={@JoinColumn(name=\"");
    String _name_2 = a.getName();
    _builder.append(_name_2, "");
    _builder.append("\")},inverseJoinColumns={@JoinColumn(name=\"");
    String _name_3 = ar.getName();
    _builder.append(_name_3, "");
    _builder.append("\")})");
    return _builder;
  }
  
  public CharSequence importOneToOne() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.OneToOne;");
    return _builder;
  }
  
  public CharSequence importOneToMany() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.OneToMany;");
    return _builder;
  }
  
  public CharSequence importManyToOne() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.ManyToOne;");
    return _builder;
  }
  
  public CharSequence importManyToMany() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.ManyToMany;");
    return _builder;
  }
  
  public CharSequence importEntityAnnotation() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.Entity;");
    return _builder;
  }
  
  public CharSequence importId() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.Id;");
    return _builder;
  }
  
  public CharSequence importGeneratedValue() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.GeneratedValue;");
    return _builder;
  }
  
  public CharSequence importTemporal() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.Temporal;");
    _builder.newLine();
    _builder.append("import javax.persistence.TemporalType;");
    return _builder;
  }
  
  public CharSequence importInheritance() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.Inheritance;");
    _builder.newLine();
    _builder.append("import javax.persistence.InheritanceType;");
    return _builder;
  }
  
  public CharSequence importTable() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.Table;");
    return _builder;
  }
  
  public CharSequence importColumn() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.Column;");
    return _builder;
  }
  
  public CharSequence importJoinColumn() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.JoinColumn;");
    return _builder;
  }
  
  public CharSequence importPrimaryKeyJoinColumn() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.PrimaryKeyJoinColumn;");
    return _builder;
  }
  
  public CharSequence importJoinTable() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.JoinTable;");
    return _builder;
  }
  
  public CharSequence importCascade() {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("import javax.persistence.CascadeType;");
    return _builder;
  }
}
